var express = require('express')
var app = express()
var bodyParser = require('body-parser');
var mySession = require('./mySession')

app.use(express.static('public'));
app.use(bodyParser.json());
app.use(mySession({
    expireTime: 300000 //6 minute
}))
app.use('/test', require('./controllers/test'))
app.use('/yjc', require('./controllers/yjc'))
app.use('/zhuajiu', require('./controllers/zhuajiu'))

//缓存用户信息
app.post('/setUser',(req,res) => {
    var user = req.body.user
    req.session.user = user
    //console.log('user.avataURL: '+user.avatarUrl)
    res.end()
})


app.listen(3000, function () {
    console.log('Example app listening on port 3000!');
});
